package com.github.tangmonkmeat;

import java.util.Scanner;
public class Main{

public static void main(String[] args){
        try (Scanner scanner = new Scanner(System.in)) {
        int n = scanner.nextInt();
        if (n <= 9) {
        System.out.println(n);
        } else if (n > 45) {
        System.out.println(-1);
        } else {
        int temp = 9;
        int i = 0;
        int res = 0;
        while (n > 0) {
        res = temp * (int) Math.pow(10, i) + res;
        i++;
        n = n - temp;
        temp = n > 9 ? temp - i : n;
        }
        System.out.println(res);
        }
        }
        }

        }
